What is decompress-tar?
The decompress-tar npm package is a module designed to decompress tarball files (.tar). It is often used in conjunction with other decompression modules to handle different compression formats. The package provides a simple API for extracting files from a tar archive.
What are decompress-tar's main functionalities?
Decompress tar files
This feature allows you to decompress .tar files. The code sample shows how to use the decompress-tar plugin with the decompress module to extract files from a tar archive to a specified directory.
const decompress = require('decompress');
const decompressTar = require('decompress-tar');
decompress('unicorn.tar', 'dist', {
plugins: [
decompressTar()
]
}).then(files => {
console.log('Files decompressed successfully!');
});
Other packages similar to decompress-tar
tar
The 'tar' package provides the ability to create, extract, and manipulate tarball archives. It has a more comprehensive feature set for handling tar files compared to decompress-tar, which is specifically for decompression.
tar-fs
The 'tar-fs' package allows for packing and extracting tarball filesystem streams. It is similar to decompress-tar but also supports packing, and it works with the file system directly.
unzipper
The 'unzipper' package is for extracting .zip files. While it is not for tar files, it provides similar decompression functionality for a different archive format.
decompress-tar
tar decompress plugin
Install
$ npm install decompress-tar
Usage
const decompress = require('decompress');
const decompressTar = require('decompress-tar');
decompress('unicorn.tar', 'dist', {
plugins: [
decompressTar()
]
}).then(() => {
console.log('Files decompressed');
});
API
decompressTar()(input)
Returns both a Promise for a Buffer and a Duplex stream.
input
Type: Buffer
Stream
Buffer or stream to decompress.
License
MIT © Kevin Mårtensson